<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!--<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />-->
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/Public/favicon.ico" >
<LINK rel="Shortcut Icon" href="/Public/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/Public/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/Public/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui/css/style.css" />
<link rel="stylesheet" href="/Public/css/page.css">

<link href="/Public/dxk/icheck.css" rel="stylesheet">
<script src="/Public/dxk/icheck.js?v=1.0.2"></script>
              
                <script>
                    $(document).ready(function(){
                        $('.user-sex input').each(function(){
                            var self = $(this),
                                    label = self.next(),
                                    label_text = label.text();

                            label.remove();
                            self.iCheck({
                                checkboxClass: 'icheckbox_sm-blue',
                                radioClass: 'radio_sm-blue',
                                insert: label_text
                            });
                        });
                    });
                </script>
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->

<title>用户管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户管理 <span class="c-gray en">&gt;</span> 用户列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
    	<form action="<?php echo U('User/search');?>" method="post">
    	<input type="text" class="input-text" style="width:250px" placeholder="输入用户名称" value="<?php echo ($searusername); ?>" name="username">
		<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
	</form>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
		  <a href="javascript:;" onclick="member_add('添加用户','<?php echo U('User/memberadd');?>','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加用户</a>
		</span>
		<span class="r">共有数据：<strong><?php echo ($UserNum); ?></strong> 条</span>
	</div>
	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th width="30">ID</th>
				<th width="100">用户名</th>
				<th width="90">所属区域</th>
				<!--<th width="90">负责银行</th>-->
				<th width="150">角色</th>
				<th width="150">OA权限</th>
				<th width="150">直属上级</th>
				<th width="40">电话</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			<?php if(is_array($users)): $i = 0; $__LIST__ = $users;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$us): $mod = ($i % 2 );++$i;?><tr class="text-c">
				<td><input type="checkbox" value="<?php echo ($us["user_id"]); ?>" name="id"></td>
				<td><?php echo ($i); ?></td>
				<td><u style="cursor:pointer" class="text-primary" onclick="member_edit('编辑','<?php echo U('User/memberalert',array('id'=>$us['user_id']));?>','','600','500')"><?php echo ($us["user_name"]); ?></u></td>
				<td><?php echo (returnPlace($us["place"])); ?></td>
				<!--<td><?php echo ($us["bank_id"]); ?></td>-->
				<td><?php echo (returnRole($us["level"])); ?></td>
				<td><?php echo (get_oa_level($us["oa_level"])); ?></td>
				<td><?php echo (getUsername($us["leader"])); ?></td>
				<td><?php echo ($us["phone"]); ?></td>
				<td class="td-manage">
					<a title="编辑" href="javascript:;" onclick="member_edit('编辑','<?php echo U('User/memberalert',array('id'=>$us['user_id']));?>','<?php echo ($us["user_id"]); ?>','600','500')" class="ml-5" style="text-decoration:none">编辑</a>
				 <a style="text-decoration:none" class="ml-5" onClick="change_password('修改密码','<?php echo U('User/memberchangepassword',array('id'=>$us['user_id']));?>','10001','600','270')" href="javascript:;" title="修改密码">修改密码</a>
				 <a title="删除" href="javascript:;" onclick="member_del(this,'<?php echo ($us["user_id"]); ?>')" class="ml-5" style="text-decoration:none">删除</a>
			 </td>
			</tr><?php endforeach; endif; else: echo "" ;endif; ?>
		</tbody>
	</table>
	</div>
	<div class="manu">
        <?php echo ($page); ?>
    </div>
</div>



<script type="text/javascript" src="/Public/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="/Public/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/messages_zh.min.js"></script>
<script type="text/javascript" src="/Public/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/Public/static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/Public/lib/Validform/5.3.2/Validform.min.js"></script>
<script src="/Public/laydate/laydate.js"></script>

<script type="text/javascript">
$(function(){
	$('.table-sort').dataTable({
		"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
		]
	});
	$('.table-sort tbody').on( 'click', 'tr', function () {
		if ( $(this).hasClass('selected') ) {
			$(this).removeClass('selected');
		}
		else {
			table.$('tr.selected').removeClass('selected');
			$(this).addClass('selected');
		}
	});
});
/*用户-添加*/
function member_add(title,url,w,h){
	layer_show(title,url,w,h);
}

/*用户-编辑*/
function member_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*密码-修改*/
function change_password(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*用户-删除*/
function member_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			url:'<?php echo U("User/delCheck");?>',
			type:'post',
			data:{userid:id},
			dataType:'json',
			success:function(data){
				if(data.ResultCode == '200'){
					$(obj).parents("tr").remove();
					layer.msg('已删除!',{icon:1,time:1000});
				}
				else if(data.ResultCode == '500'){
						layer.msg(data.ResultMessage);
				}
			}
		})

	});
}

function datadel(){
	var chk_value =[];
   $('input[name="id"]:checked').each(function(){
   chk_value.push($(this).val());
  });

  if(chk_value.length==0){
    layer.msg('您还没有选择要删除的数据');
  }
  else{
    $.ajax({
           type:"post",
           url:"<?php echo U('User/delDatas');?>",
           data:{id:chk_value},
           dataType:'json',
           success:function(msg){
               if(msg.ResultCode=='200'){
                 layer.msg(msg.ResultMessage,{time:1000},  function(){
                   window.location.reload();
                 });
               }
               else{layer.msg(msg.ResultMessage)}
           }
       });
  }
}
</script>
</body>
</html>